
<script setup lang="ts">
// 访问父路由 demo 中 useFetch 的缓存值
const { data: posts } = useNuxtData('/api/user')

// 访问父路由 demo 中 useAsyncData 的缓存值
const { data: offers } = useNuxtData('/cart/offers')
</script>

<template>
  <div>
    <h1>asyncData posts: {{ posts }}</h1>
    <h1>asyncData offers: {{ offers }}</h1>
    <UButton @click="() => { clearNuxtData('/api/user') }">'/api/user'会被重新获取</UButton>
    <UButton @click="() => { clearNuxtData() }">所有 useAsyncData 和 useFetch 的键都会被重新获取</UButton>
    <UButton @click="() => { refreshNuxtData('/api/user') }">'/api/user'会被重新获取</UButton>
    <UButton @click="() => { refreshNuxtData() }">所有 useAsyncData 和 useFetch 的键都会被重新获取</UButton>
  </div>
</template>

<style scoped>

</style>